/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.dianlan.protocol.active;

import info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol;
import info.peigen.hotpot.component.gateway.dianlan.facade.enums.DianlanChargingPortInsertStatus;
import info.peigen.hotpot.component.gateway.dianlan.facade.enums.DianlanChargingPortReturnStatus;
import info.peigen.hotpot.component.gateway.dianlan.facade.enums.DianlanChargingStatus;
import info.peigen.hotpot.component.gateway.dianlan.facade.enums.DianlanHardwareFailure;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.*;

/**
 * <b>(DianlanStubStatusResponse)</b>
 * <p>
 * 读取实时监测数据
 * 帧类型码 0x13
 * 序列号域 1A03
 * 数据长度 64
 * 帧校验域 9DAC
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/8/19
 */
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class DianlanStubStatusResponse {
    /** 交易流水号 */
    @DianlanProtocol(length = 16, start = 0, end = 16, dataType = BCD)
    String                          transNo;
    /** 桩编码 */
    @DianlanProtocol(length = 7, start = 16, end = 23, dataType = BCD)
    String                          stubNo;
    /** 充电枪号 */
    @DianlanProtocol(length = 1, start = 23, end = 24, dataType = BCD)
    String                          chargingPortNo;
    /** 充电状态  ("00", "离线"),("01", "故障"),("02", "空闲"),("03", "充电"), */
    @DianlanProtocol(length = 1, start = 24, end = 25, dataType = ENUM)
    DianlanChargingStatus           chargingStatus;
    /** 枪是否归位 ("00", "否"),("01", "是"), */
    @DianlanProtocol(length = 1, start = 25, end = 26, dataType = ENUM)
    DianlanChargingPortReturnStatus returnStatus;
    /** 是否插枪  ("00", "否"),("01", "是"), */
    @DianlanProtocol(length = 1, start = 26, end = 27, dataType = ENUM)
    DianlanChargingPortInsertStatus insertStatus;
    /** 输出电压,精确到小数点后一位；待机置零 */
    @DianlanProtocol(length = 2, start = 27, end = 29, dataType = BIN)
    String                          outputVoltage;
    /** 输出电流,精确到小数点后一位；待机置零 */
    @DianlanProtocol(length = 2, start = 29, end = 31, dataType = BIN)
    String                          outputCurrent;
    /** 枪线温度；整形，偏移量-50: 待机置零 */
    @DianlanProtocol(length = 1, start = 31, end = 32, dataType = BIN)
    String                          portLineTemperature;
    /** 枪线编码 没有置零 */
    @DianlanProtocol(length = 8, start = 32, end = 40, dataType = BIN)
    String                          portLineNo;
    /** SOC 待机置零: 交流桩置零 */
    @DianlanProtocol(length = 1, start = 40, end = 41, dataType = BIN)
    String                          soc;
    /** 电池组最高温度 整形，偏移量-50 ºC；待机置零；交流桩置零 */
    @DianlanProtocol(length = 1, start = 41, end = 42, dataType = BIN)
    String                          batteryMaxTemperature;
    /** 累计充电时间 单位：min；待机置零 */
    @DianlanProtocol(length = 2, start = 42, end = 44, dataType = BIN)
    String                          cumulativeChargingTime;
    /** 剩余时间 单位：min；待机置零、交流桩置零 */
    @DianlanProtocol(length = 2, start = 44, end = 46, dataType = BIN)
    String                          timeRemaining;
    /** 充电度数 精确到小数点后四位；待机置零 */
    @DianlanProtocol(length = 4, start = 46, end = 50, dataType = BIN)
    String                          chargingCount;
    /** 计损充电度数 精确到小数点后四位；待机置零,未设置计损比例时等于充电度数 */
    @DianlanProtocol(length = 4, start = 50, end = 54, dataType = BIN)
    String                          lossChargingCount;
    /** 已充金额 精确到小数点后四位；待机置零,（电费+服务费）*计损充电度数 */
    @DianlanProtocol(length = 4, start = 54, end = 58, dataType = BIN)
    String                          chargingAmount;
    /** 硬件故障 */
    @DianlanProtocol(length = 2, start = 58, end = 60, dataType = ENUM)
    DianlanHardwareFailure          hardwareFailure;
}